//
//  childDetailHeadV.m
//  LoveDraw
//
//  Created by 梁晨 on 2017/6/26.
//  Copyright © 2017年 梁晨. All rights reserved.
//

#import "childDetailHeadV.h"

@implementation childDetailHeadV

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor clearColor];
        
        // 头部视图 白色底色
        UIView *whiteBackV = [[UIView alloc]init];
        whiteBackV.backgroundColor = [UIColor whiteColor];
        [self addSubview:whiteBackV];
        
        [whiteBackV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left);
            make.right.equalTo(self.mas_right);
            make.bottom.equalTo(self.mas_bottom);
            make.height.mas_equalTo(120);
        }];
        
        // 头像
        self.headimageV = [[UIImageView alloc]init];
        [self addSubview:self.headimageV];
        self.headimageV.layer.masksToBounds = YES;
        self.headimageV.layer.cornerRadius = 60;
        self.headimageV.layer.borderWidth = 2;
        self.headimageV.layer.borderColor = [UIColor whiteColor].CGColor;
        [self.headimageV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.mas_centerX);
            make.centerY.equalTo(self.mas_centerY).offset(20);
            make.width.mas_equalTo(120);
            make.height.mas_equalTo(120);
        }];
        
        // 姓名
        self.nameL = [[UILabel alloc]init];
        [self addSubview:self.nameL];
        [self.nameL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.mas_centerX);
            make.top.equalTo(self.headimageV.mas_bottom).offset(8);
        }];

        self.sexImage = [[UIImageView alloc]init];
        [self addSubview:self.sexImage];
        [self.sexImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.nameL.mas_centerY).offset(-10);
            make.left.equalTo(self.nameL.mas_right).offset(5);
            make.width.mas_equalTo(10);
            make.height.mas_equalTo(10);
        }];

        
        // 底部分割线
        UIView *bottomLine = [[UIView alloc]init];
        [self addSubview:bottomLine];
        bottomLine.backgroundColor = PKCOLOR(243, 246, 246);
        [bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left);
            make.right.equalTo(self.mas_right);
            make.bottom.equalTo(self.mas_bottom);
            make.height.mas_equalTo(1);
        }];
    }
    return self;
}

@end
